import { RoutesAlias } from '../routesAlias'
import { AppRouteRecord } from '@/types/router'

/**
 * 菜单列表、异步路由
 *
 * 支持两种模式:
 * 前端静态配置 - 直接使用本文件中定义的路由配置
 * 后端动态配置 - 后端返回菜单数据，前端解析生成路由
 *
 * 菜单标题（title）:
 * 可以是 i18n 的 key，也可以是字符串，比如：'用户列表'
 *
 * RoutesAlias.Layout 指向的是布局组件，后端返回的菜单数据中，component 字段需要指向 /index/index
 * 路由元数据（meta）：异步路由在 asyncRoutes 中配置，静态路由在 staticRoutes 中配置
 */
export const asyncRoutes: AppRouteRecord[] = [
  {
    name: 'Dashboard',
    path: '/dashboard',
    component: RoutesAlias.Layout,
    meta: {
      title: 'menus.dashboard.title',
      icon: '&#xe721;'
    },
    children: [
      {
        path: 'console',
        name: 'Console',
        component: RoutesAlias.Dashboard,
        meta: {
          title: 'menus.dashboard.console',
          keepAlive: false,
          fixedTab: true
        }
      },
      // {
      //   path: 'withdrawal_info',
      //   name: 'Withdrawal_Info',
      //   component: RoutesAlias.withdrawal_info,
      //   meta: {
      //     title: '账户信息',
      //     keepAlive: false,
      //     fixedTab: true
      //   }
      // }
    ]
  },
  {
    path: '/system',
    name: 'System',
    component: RoutesAlias.Layout,
    meta: {
      title: 'menus.system.title',
      icon: '&#xe7b9;',
      roles: ['R_SUPER', 'R_ADMIN']
    },
    children: [
      {
        path: 'referralProgram',
        name: 'ReferralProgram',
        component: RoutesAlias.referralProgram,
        meta: {
          title: 'menus.system.plan',
          keepAlive: false,
          roles: ['R_SUPER', 'R_ADMIN']
        }
      },
      {
        path: 'inviter',
        name: 'Inviter',
        component: RoutesAlias.inviter,
        meta: {
          title: 'menus.system.inviter',
          keepAlive: false,
          roles: ['R_SUPER', 'R_ADMIN']
        }
      },
      // {
      //   path: 'user',
      //   name: 'User',
      //   component: RoutesAlias.User,
      //   meta: {
      //     title: 'menus.system.user',
      //     keepAlive: false,
      //     roles: ['R_SUPER', 'R_ADMIN']
      //   }
      // },
      // {
      //   path: 'role',
      //   name: 'Role',
      //   component: RoutesAlias.Role,
      //   meta: {
      //     title: 'menus.system.role',
      //     keepAlive: false,
      //     roles: ['R_SUPER']
      //   }
      // },
      {
        path: 'user-center',
        name: 'UserCenter',
        component: RoutesAlias.UserCenter,
        meta: {
          title: 'menus.system.userCenter',
          isHide: true,
          keepAlive: false,
          isHideTab: true
        }
      },
      // {
      //   path: 'menu',
      //   name: 'Menus',
      //   component: RoutesAlias.Menu,
      //   meta: {
      //     title: 'menus.system.menu',
      //     keepAlive: false,
      //     roles: ['R_SUPER'],
      //     authList: [
      //       {
      //         title: '新增',
      //         authMark: 'add'
      //       },
      //       {
      //         title: '编辑',
      //         authMark: 'edit'
      //       },
      //       {
      //         title: '删除',
      //         authMark: 'delete'
      //       }
      //     ]
      //   }
      // }
    ]
  },
  // {
  //   path: '/result',
  //   name: 'Result',
  //   component: RoutesAlias.Layout,
  //   meta: {
  //     title: 'menus.result.title',
  //     icon: '&#xe715;'
  //   },
  //   children: [
  //     {
  //       path: 'success',
  //       name: 'ResultSuccess',
  //       component: RoutesAlias.Success,
  //       meta: {
  //         title: 'menus.result.success',
  //         keepAlive: false
  //       }
  //     },
  //     {
  //       path: 'fail',
  //       name: 'ResultFail',
  //       component: RoutesAlias.Fail,
  //       meta: {
  //         title: 'menus.result.fail',
  //         keepAlive: false
  //       }
  //     }
  //   ]
  // },
  // {
  //   path: '/exception',
  //   name: 'Exception',
  //   component: RoutesAlias.Layout,
  //   meta: {
  //     title: 'menus.exception.title',
  //     icon: '&#xe820;'
  //   },
  //   children: [
  //     {
  //       path: '403',
  //       name: '403',
  //       component: RoutesAlias.Exception403,
  //       meta: {
  //         title: 'menus.exception.forbidden',
  //         keepAlive: false,
  //         isFullPage: true
  //       }
  //     },
  //     {
  //       path: '404',
  //       name: '404',
  //       component: RoutesAlias.Exception404,
  //       meta: {
  //         title: 'menus.exception.notFound',
  //         keepAlive: false,
  //         isFullPage: true
  //       }
  //     },
  //     {
  //       path: '500',
  //       name: '500',
  //       component: RoutesAlias.Exception500,
  //       meta: {
  //         title: 'menus.exception.serverError',
  //         keepAlive: false,
  //         isFullPage: true
  //       }
  //     }
  //   ]
  // },
  {
    path: '/finance',
    name: 'Finance',
    component: RoutesAlias.Layout,
    meta: {
      title: 'menus.Finance.title',
      icon: '&#xe7b9;',
      roles: ['R_SUPER', 'R_ADMIN']
    },
    children: [
      {
        path: 'withdrawal_History',
        name: 'withdrawal_History',
        component: RoutesAlias.withdrawal_History,
        meta: {
          title: 'menus.Finance.withdrawal_History',
          keepAlive: false,
          roles: ['R_SUPER', 'R_ADMIN']
        }
      },
      {
        path: 'transactionHistory',
        name: 'TransactionHistory',
        component: RoutesAlias.transactionHistory,
        meta: {
          title: 'menus.Finance.transactionHistory',
          keepAlive: false,
          roles: ['R_SUPER', 'R_ADMIN']
        }
      },
      {
        path: 'withdrawal_settings',
        name: 'Withdrawal_Settings',
        component: RoutesAlias.withdrawal_settings,
        meta: {
          title: '提现设置',
          keepAlive: false,
          roles: ['R_SUPER', 'R_ADMIN']
        }
      },
    ]
  },
  // {
  //   path: '/safeguard',
  //   name: 'Safeguard',
  //   component: RoutesAlias.Layout,
  //   meta: {
  //     title: '数据概况',
  //     icon: '&#xe7b9;',
  //     roles: ['R_SUPER', 'R_ADMIN']
  //   },
  //   children: [
  //     {
  //       path: 'orderOverview',
  //       name: 'OrderOverview',
  //       component: RoutesAlias.orderOverview,
  //       meta: {
  //         title: '订单概况',
  //         keepAlive: false,
  //         roles: ['R_SUPER', 'R_ADMIN']
  //       }
  //     },
  //     {
  //       path: 'promoterOverview',
  //       name: 'PromoterOverview',
  //       component: RoutesAlias.promoterOverview,
  //       meta: {
  //         title: '推广人概况',
  //         keepAlive: false,
  //         roles: ['R_SUPER', 'R_ADMIN']
  //       }
  //     }
  //   ]
  // },
  {
    path: '/user',
    name: 'User',
    // component: RoutesAlias.Layout,
    meta: {
      title: '个人中心',
      icon: '&#xe7b9;',
      roles: ['R_SUPER', 'R_ADMIN'],
      isHide: true
    },
    children: [
      {
        path: 'personalCenter',
        name: 'PersonalCenter',
        component: RoutesAlias.PersonalCenter,
        meta: {
          title: '个人中心',
          keepAlive: false,
          roles: ['R_SUPER', 'R_ADMIN']
        }
      }
    ]
  }
]
